package com.kidedu.action;

import java.util.List;

import com.alibaba.fastjson.JSON;
import com.kidedu.entity.KNews;
import com.kidedu.service.IKNewsService;
import com.kidedu.util.SpringContextUtil;

public class KNewsAction {
    
    private byte state;
	private int count;
	private String knewsJSON;
	private List<KNews> knewsList;
	private IKNewsService iKNewsService = (IKNewsService)SpringContextUtil.getBean("iKNewsService");
	
	public String selectKNewsByNstate() {
		knewsList = iKNewsService.selectKNewsByNstate(state, count);
		return "JSON";
	}
	
	public String insertKNews() {
		KNews knews = JSON.parseObject(knewsJSON, KNews.class);
		iKNewsService.insertKNews(knews);
		return "JSON";
	}

	public String getKnewsJSON() {
		return knewsJSON;
	}

	public void setKnewsJSON(String knewsJSON) {
		this.knewsJSON = knewsJSON;
	}

	public byte getState() {
		return state;
	}

	public void setState(byte state) {
		this.state = state;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public List<KNews> getKnewsList() {
		return knewsList;
	}

	public void setKnewsList(List<KNews> knewsList) {
		this.knewsList = knewsList;
	}
	
}
